import { useLayoutEffect } from 'react';
import ScrollReveal from 'scrollreveal';

export default (className) => {
  useLayoutEffect(() => {
    Array.from(document.getElementsByClassName(className) || []).forEach(
      (item, index) => {
        ScrollReveal().reveal(item, {
          opacity: 0,
          distance: '20px',
          delay: 200 + index * 100,
          duration: 500,
        });
      },
    );
  }, []);
};
